import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random

import sim_creatures, main
from util import *

description = \
"""
"No light; but rather darkness visible
Served only to discover sights of woe..."

A tiny demon composed entirely of negative energy, a shadow imp was once a
thrall to a practitioner of the dark arts who failed in an attempt to escape the
chains of its eternal servitude. Its punishment is perversely ironic: it was
released from bondage, but denied return to its original demonic plane of
existence. It now wanders the forgotten crevices of the world, stripped of any
hope of homecoming as well as the existential fulfillment of service. The tiny
red eyes that narrow as you approach burn with a hatred that has festered in the
darkness for eons.
"""

class MonsterClass(sim_creatures.Monster):
    def __init__(self):
        sim_creatures.Monster.__init__(
            self,
            'shadow imp',    # name
            parole.map.AsciiTile('I', (64, 64, 64)), # symbol, color
            8,  # str
            10, # dex
            10,  # con
            17, # per
            17, # spd
            2,  # level
            20, # xp value
            False, # name starts with vowel? i.e., use "an" instead of "a"
            [],  # equipment slots
            'torment', # unarmed attack verb
            'die',  # death verb
            False,    # leaves corpse?
            1000, # unarmed attack energy
            description,
            bloodClass=sim_creatures.BlackBlood,
            lightTolerance=0.8,
            lightSensitivity=2,
            feelsPain=False,
        )

    def die(self, dieVerb=None, corpsePossible=False):
        pos = self.pos
        tile = self.parentTile
        sim_creatures.Monster.die(self, dieVerb=dieVerb, corpsePossible=False)

        # special effect: shadow imps leave a permanent negative lightsource
        # when they die
        if visible(tile):
            main.transient("An unholy darkness bursts forth from the slain "\
                           "imp's body, consuming it.", tile)
        lightSource = parole.map.LightSource((255,255,255), -1.5)
        lightSource.apply(tile.map, pos)
        tile.map.update()

        if main.mapFrame.fovObj and not main.player.dead:
            main.mapFrame.touchFOV()


#========================================
thingClass = MonsterClass


